package xyz.mumuwei.youthcourseserver.controller;


import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.mumuwei.youthcourseserver.common.dto.PageDto;
import xyz.mumuwei.youthcourseserver.common.lang.Result;
import xyz.mumuwei.youthcourseserver.service.CourseEvaluateService;

/**
 * 课程评价
 * @author mumuwei
 * @since 2022-02-19
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/evaluate")
public class CourseEvaluateController {

    final CourseEvaluateService evaluateService;

    /**
     * 根据课程id获取评论列表——不分页
     */
    @GetMapping("/course/{courseId}")
    public Result getListByCourseId(@PathVariable Integer courseId) {
        return evaluateService.getListByCourseId(courseId);
    }

    /**
     * 根据课程id获取评论列表——分页
     */
    @GetMapping("/course-page/{courseId}")
    public Result getPageByCourseId(@PathVariable Integer courseId, PageDto pageDto) {
        return evaluateService.getPageByCourseId(courseId, pageDto);
    }

    /**
     * 获取课程质量排行
     */
    @GetMapping("/courseQuality")
    public Result getCourseQuality() {
        return evaluateService.getCourseQuality();
    }
}

